var sliderWidth = 96; // 需要设置slider的宽度，用于计算中间位置

Page({
  data: {
    tabs: ["微店收藏", "商品收藏"],
    activeIndex: 1,
    sliderOffset: 0,
    sliderLeft: 0,
    firstList: [{ imgUrl: "", name: "张建锋 的到家服务平台", tool: "家庭保洁，家电维修，管道疏通", parts: "家具 / 家电常用零配件" }, { imgUrl: "", name: "张建锋 的到家服务平台", tool: "家庭保洁，家电维修，管道疏通", parts: "家具 / 家电常用零配件" }
      , { imgUrl: "", name: "张建锋 的到家服务平台", tool: "家庭保洁，家电维修，管道疏通", parts: "家具 / 家电常用零配件" }, { imgUrl: "", name: "张建锋 的到家服务平台", tool: "家庭保洁，家电维修，管道疏通", parts: "家具 / 家电常用零配件" }],

    twoList: [{ imgUrl: "", name: "ksdjka健康撒娇加萨迪克啊ksdjka健康撒娇加萨迪克啊", money: "38", where:"侯坤 的到家服务平台"},
      { imgUrl: "", name: "dkalk s就付款第三领导说了ksdjka健康撒娇加萨迪克啊", money: "38", where: "侯坤 的到家服务平台" },
      { imgUrl: "", name: "sdfl空军力量的ksdjka健康撒娇加萨迪克啊飞机啊可是觉得 ", money: "38", where: "侯坤 的到家服务平台" },]
  },
  onLoad: function () {
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
          sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
        });
      }
    });
  },
  tabClick: function (e) {
    this.setData({
      sliderOffset: e.currentTarget.offsetLeft,
      activeIndex: e.currentTarget.id
    });
  }
});